The Covariance Matrix
Let's take a moment to learn a compact way to represent the portfolio variance using matrices and vectors.
Remember that the portfolio variance we calculated for our two-stock portfolio was:
σP2=xA2σA2+xB2σB2+2xAxBCov(rA,rB).
But
σA2=Cov(rA,rA),
so
σP2=xA2Cov(rA,rA)+xB2Cov(rB,rB)+2xAxBCov(rA,rB).
This expression now has a nice parallel structure. If we create a matrix called the covariance matrix,
P=[Cov(rA,rA)Cov(rA,rB) Cov(rB,rA)Cov(rB,rB)],
and a vector of weights:
x=[xA xB],
and do the following matrix multiplication:
[xAxB][Cov(rA,rA)Cov(rB,rA)Cov(rA,rB)Cov(rB,rB)][xAxB]
=[xAxB][xACov(rA,rA)+xBCov(rA,rB)xACov(rB,rA)+xBCov(rB,rB)]
=xAxACov(rA,rA)+xAxBCov(rA,rB)+xAxBCov(rA,rB)+xBxBCov(rB,rB)
=xA2σA2+xB2σB2+2xAxBCov(rA,rB),
we see that we recover the expression for
σP2
.
So:
σP2=xTPx
A polynomial where the sums of the exponents of the variables in each term equals 2 is called a quadratic form. An example:
4x2−2xy+3y2
The portfolio variance is an example of a quadratic form (remember,
xA
and
xB
are the variables here):
σP2=xA2σA2+xB2σB2+2xAxBCov(rA,rB)
A quadratic form can always been written as
xTPx
, where P is a symmetric matrix.